package hl.demosample.ui.adapter

import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import hl.demosample.R
import hl.demosample.app.ext.setAdapterAnimation
import hl.demosample.app.util.SettingUtil
import hl.demosample.data.model.bean.GirlClassifyData

/*
* path: DemoSample 
* Author: 86133
* Create: 2021-06-30 16:06
* Changes (from 2021-06-30)
* Desc:
*/
class GirlClassifyAdapter(data: MutableList<GirlClassifyData.DataBean>?) :
    BaseQuickAdapter<GirlClassifyData.DataBean, BaseViewHolder>(R.layout.girl_classify_item, data) {

    init {
        setAdapterAnimation(SettingUtil.getListMode())
    }

    override fun convert(holder: BaseViewHolder, item: GirlClassifyData.DataBean) {
        item.run {
            Glide.with(context).load(item.url)
                .apply(RequestOptions().placeholder(R.mipmap.ic_launcher))
                .into(holder.getView(R.id.iv_girl))
            holder.setText(R.id.tv_time, createdAt)
            holder.setText(R.id.tv_desc, desc)
            holder.setText(R.id.tv_title, title)
            holder.setText(R.id.tv_author, author)
        }
    }
}